<template>
  <div class="comment-item">
    <div class="row">
      <div class="left">
        <img v-lazy="c_item.user_photo" />
        <span class="nickName">{{ c_item.nickName }}</span>
      </div>
      <div class="right">
        <div>{{ formatDate(c_item.create_time, "YYYY-MM-DD HH:mm:ss") }}</div>
        <div>
          <van-rate
            v-model="c_item.star"
            :size="20"
            color="#ffd21e"
            void-icon="star"
            void-color="#eee"
            readonly
          />
        </div>
      </div>
    </div>
    <div class="comment-text">{{ c_item.comment_text }}</div>
  </div>
</template>

<script setup>
import { formatDate } from "../filters/DateFilters.js";
const props = defineProps({
  c_item: {
    type: Object,
    require: true,
  },
});
</script>

<style lang="scss" scoped>
.comment-item {
  box-sizing: border-box;
  padding: 3px;
  border-bottom: 1px solid lightgray;
  .row {
    @include flexbox(row, space-between, center);
    .left {
      @include flexbox(row, flex-start, center);
      img {
        width: 30px;
        height: 30px;
        object-fit: cover;
        border-radius: 50%;
        .nickName {
          margin-left: 5px;
          font-size: 18px;
        }
      }
    }
    .right {
      @include flexbox(column, space-between, flex-end);
      font-size: 12px;
    }
  }
  .comment-text {
    line-height: 1.6;
  }
}
</style>